<template>
  <div class="card-list">
    <a-row :gutter="24">
      <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
        <a-card
          class="project-list"
          style="margin-bottom: 24px;"
          :bordered="true"
          title="运动员列表"
          :body-style="{ padding: 0 }"
        >
          <a-list rowKey="id" :grid="{ lg: 3, md: 2, sm: 1, xs: 1}" :dataSource="dataSource">
            <a-list-item slot="renderItem" slot-scope="item">
              <template v-if="!item || item.id === undefined">
                <a-button class="new-btn" type="dashed">
                  <a-icon type="plus" />新增队伍
                </a-button>
              </template>
              <template v-else>
                <a-card :hoverable="true" :key="item.id">
                  <a-card-meta @click="tabChange(item)">
                    <a slot="title">{{ item.title }}</a>
                    <a-avatar class="card-avatar" slot="avatar" :src="item.avatar" size="large" />
                    <div class="meta-content" slot="description">{{ item.content }}</div>
                  </a-card-meta>
                  <template class="ant-card-actions" slot="actions">
                    <a>配置管理员</a>
                    <a>删除</a>
                  </template>
                </a-card>
              </template>
            </a-list-item>
          </a-list>
        </a-card>
      </a-col>
    </a-row>
  </div>
</template>

<script>
const dataSource = [];
dataSource.push({});
for (let i = 0; i < 4; i++) {
  dataSource.push({
    id: i,
    title: i+"-举重",
    avatar: "../../assets/logo.png",
    content: "13124321513515"
  });
}

export default {
  // name: "CardList",
  data() {
    return {
      dataSource
    };
  },
  methods: {
    tabChange(item) {
      console.log(item.id);
      this.$router.push({
        name:'athlete'
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.card-list {
  /deep/.ant-list-item {
    margin-bottom: 0 !important;
  }
  .card-title {
    font-size: 0;

    a {
      color: rgba(0, 0, 0, 0.85);
      margin-left: 12px;
      line-height: 24px;
      height: 24px;
      display: inline-block;
      vertical-align: top;
      font-size: 14px;

      &:hover {
        color: #1890ff;
      }
    }
  }
  .card-description {
    color: rgba(0, 0, 0, 0.45);
    height: 44px;
    line-height: 22px;
    overflow: hidden;
  }
  .ant-card-meta-description {
    color: rgba(0, 0, 0, 0.45);
    height: 44px;
    line-height: 22px;
    overflow: hidden;
  }
}
.ant-card-actions {
  background: #f7f9fa;
  padding: 0;
  li {
    float: left;
    text-align: center;
    margin: 12px 0;
    color: rgba(0, 0, 0, 0.45);
    width: 50%;

    &:not(:last-child) {
      border-right: 1px solid #e8e8e8;
    }

    a {
      color: rgba(0, 0, 0, 0.45);
      line-height: 22px;
      display: inline-block;
      width: 100%;
      &:hover {
        color: #aaabac;
      }
    }
  }
}
.new-btn {
  background-color: #fff;
  border-radius: 2px;
  width: 100%;
  height: 141.4px;
}
</style>
